const express = require('express');
const router = express.Router();
const data = [];
const query = [];
const vehicle = [];
const dutyUnits = [];
let count = 1;
for(let i = 1; i < 51; i++) {
    count += 1;
    data.push({
        id: `${i}`,
        code: `code${i}`,
        serviceName: `serviceName${i}`,
        dealerId: `dealerId${i}`,
        dealerCode: `dealerCode${i}`,
        country: `country${i}`,
        status: 1,
        startTime: '2020-04-29T07:07:47.886Z',
        endTime: '2020-04-29T07:07:47.886Z',
        content: 'string',
        isDealerApply: !(count % 2),
        rowVersion: 'string',
        options: ['update', 'addVIN', 'submit', 'abandon', 'publish', 'close', 'approve']
    });
    query.push({
        id: `${i}`,
        code: `code${i}`,
        name: `name${i}`,
        unit: 'unit',
        minQty: 2,
        // eslint-disable-next-line radix
        price: parseInt(`20${i}`),
    });
    dutyUnits.push({
        id: `${i}`,
        code: `code${i}`,
        type: 1
    });
    vehicle.push({
        id: `${i}`,
        vin: `vin${i}`,
        country: `country${i}`,
        engineCode: `engineCode${i}`,
        transmissionSn: `transmissionSn${i}`,
        remark: 0
    });
}

router.get('/', (req, res) => {
    const {pageIndex, pageSize} = req.query;
    res.json({
        message: 'ok',
        payload: {
            content: data,
            pageIndex: parseInt(pageIndex, 10),
            pageSize: parseInt(pageSize, 10),
            totalElements: 50
        }
    });
});
router.get('/query', (req, res) => {
    const {pageIndex, pageSize} = req.query;
    res.json({
        message: 'ok',
        payload: {
            content: query,
            pageIndex: parseInt(pageIndex, 10),
            pageSize: parseInt(pageSize, 10),
            totalElements: 50
        }
    });
});
router.get('/dutyUnits', (req, res) => {
    const {pageIndex, pageSize} = req.query;
    res.json({
        message: 'ok',
        payload: {
            content: dutyUnits,
            pageIndex: parseInt(pageIndex, 10),
            pageSize: parseInt(pageSize, 10),
            totalElements: 50
        }
    });
});
router.get('/vehicle', (req, res) => {
    const {pageIndex, pageSize} = req.query;
    res.json({
        message: 'ok',
        payload: {
            content: vehicle,
            pageIndex: parseInt(pageIndex, 10),
            pageSize: parseInt(pageSize, 10),
            totalElements: 50
        }
    });
});
router.get('/forTechnologyActivityClaims', (req, res) => {
    const content = [];
    for(let i = 0; i < 40; i++) content.push({
        id: `${i + 1}`,
        code: 'string',
        serviceName: 'string',
        content: 'string',
        startTime: '2020-04-30T07:18:33.951Z',
        endTime: '2020-04-30T07:18:33.951Z',
        causePartName: 'string',
        causePartCode: 'string',
        checkLabor: 1,
        checkChangeLabor: 0,
        checkChangeAssistLabor: 0,
        checkLaborFee: 1,
        checkChangeLaborFee: 1,
        checkChangeAssistLaborFee: 1
    });
    res.json({
        message: '',
        payload: {
            content,
            totalElements: 41,
        }
    });
});
router.get('/forTechnologyActivityClaims/simple', (req, res) => {
    const content = [];
    for(let i = 0; i < 10; i++)
        content.push({
            id: `2019${i}`,
            code: 'string',
            serviceName: 'string',
            content: 'string',
            startTime: '2020-04-30T07:18:33.951Z',
            endTime: '2020-04-30T07:18:33.951Z',
            causePartName: 'string',
            causePartCode: 'string',
            checkLabor: 1,
            checkChangeLabor: 0,
            checkChangeAssistLabor: 0,
            checkLaborFee: 1,
            checkChangeLaborFee: 1,
            checkChangeAssistLaborFee: 1
        });
    res.json({
        message: '',
        payload: {
            content
        }
    });
});
router.get('/:id', (req, res) => {
    res.json(
        {
            message: 'string',
            payload: {
                details: {
                    id: '4bef9c59-4d8f-4623-cdd8-08d7f24eb994',
                    brandId: '305d091e-3a99-43e0-14dd-08d76bf076c5',
                    brandCode: 'CHERY',
                    brandName: 'CHERY',
                    code: 'SL1579620200002',
                    serviceName: '测试技术升级001',
                    dealerId: '669db1db-c671-4177-7017-08d7628cd2cd',
                    dealerCode: 15796,
                    dealerName: '埃及',
                    content: '测试技术升级内容001',
                    vehicleCategory: 1,
                    checkLabor: 30,
                    checkChangeLabor: 0,
                    checkChangeAssistLabor: 0,
                    checkLaborFee: 4.8,
                    checkChangeLaborFee: 0,
                    checkChangeAssistLaborFee: 0,
                    isClaimPart: true,
                    isClaimAssist: false,
                    startTime: '2020-05-07T11:29:47.202+08:00',
                    endTime: '2021-05-07T11:29:47.202+08:00',
                    supplierId: 'ffa91653-6d0b-4006-a69d-00af008fe428',
                    supplierCode: '9BJ',
                    supplierName: '惠州市德赛西威汽车电子股份有限公司',
                    dutyUnitId: '61163731-2ac8-4d2a-865a-0584eb2aab11',
                    dutyUnitCode: 'Z P',
                    dutyUnitName: '内部分摊（乘用车装配ZP）',
                    remark: '备注001',
                    isDealerApply: false,
                    isDelay: null,
                    activityVehicleNum: 0,
                    noCompleteActivityVehicleNum: 0,
                    completeActivityVehicleNum: 0,
                    options: ['update', 'addVIN', 'submit', 'abandon', 'publish', 'close', 'approve'],
                    attachments: [
                        {
                            fileId: 'fileId',
                            fileName: 'fileName'
                        },
                        {
                            fileId: 'fileId12',
                            fileName: 'fileName12'
                        }
                    ],
                    noIsTechnologyActivityMaterialList: [
                        {
                            id: 'fe3b6bef-c151-47ef-aa54-08d7f24eb9a4',
                            technologyActivityId: '4bef9c59-4d8f-4623-cdd8-08d7f24eb994',
                            usedPartId: 'a4519a3e-b7ad-4253-a182-000001c42e8e',
                            usedPartCode: 'K-H99-1104105',
                            usedPartName: '油箱至碳罐通气硬管',
                            newPartId: 'a24f0a60-6fff-474b-afb4-000155ba70fe',
                            newPartCode: 'B14-5110113RA',
                            newPartName: '地板右前减震垫',
                            quantity: 2,
                            isCaused: true
                        },
                        {
                            id: '8b5c3c1e-dc12-4323-aa55-08d7f24eb9a4',
                            technologyActivityId: '4bef9c59-4d8f-4623-cdd8-08d7f24eb994',
                            usedPartId: 'afa41e00-c2c2-4345-bb2f-0001db3ad1b6',
                            usedPartCode: 'T11-7911011BH',
                            usedPartName: '单碟CD',
                            newPartId: '2a934910-d92e-4222-85eb-0001dcba5ae6',
                            newPartCode: 'Z-13-50-100-001',
                            newPartName: '换档导轴',
                            quantity: 3,
                            isCaused: false
                        }
                    ],
                    isTechnologyActivityMaterialList: [],
                    technologyActivityVehicleList: {
                        content: [
                            {
                                id: '93def495-b5f7-4dea-b9bd-08d7f24eb9a9',
                                technologyActivityId: '4bef9c59-4d8f-4623-cdd8-08d7f24eb994',
                                vin: 'AEGCC11B2LP000800',
                                country: null,
                                engineCode: 'SQRE4G15BAAKL00209',
                                transmissionSn: 'QR525MHJLAKL07530'
                            },
                            {
                                id: 'c2c4e5e7-9c8f-4d26-b9be-08d7f24eb9a9',
                                technologyActivityId: '4bef9c59-4d8f-4623-cdd8-08d7f24eb994',
                                vin: 'AEGCC11B2LP000801',
                                country: null,
                                engineCode: 'SQRE4G15BAAKL00227',
                                transmissionSn: 'QR525MHJLAKL07463'
                            },
                            {
                                id: '55dd6673-2247-4984-b9bf-08d7f24eb9a9',
                                technologyActivityId: '4bef9c59-4d8f-4623-cdd8-08d7f24eb994',
                                vin: 'AEGCC11B2LP000802',
                                country: null,
                                engineCode: 'SQRE4G15BAAKL00047',
                                transmissionSn: 'QR525MHJLAKL07386'
                            },
                            {
                                id: '7b560974-645d-487d-b9c0-08d7f24eb9a9',
                                technologyActivityId: '4bef9c59-4d8f-4623-cdd8-08d7f24eb994',
                                vin: 'AEGCC11B2LP000803',
                                country: null,
                                engineCode: 'SQRE4G15BAAKL00060',
                                transmissionSn: 'QR525MHJLAKL07389'
                            },
                            {
                                id: '11d3f96d-c027-4dfa-b9c1-08d7f24eb9a9',
                                technologyActivityId: '4bef9c59-4d8f-4623-cdd8-08d7f24eb994',
                                vin: 'AEGCC11B2LP000804',
                                country: null,
                                engineCode: 'SQRE4G15BAAKL00210',
                                transmissionSn: 'QR525MHJLAKL07560'
                            },
                            {
                                id: 'd3e00d98-4c9a-4a4e-b9c2-08d7f24eb9a9',
                                technologyActivityId: '4bef9c59-4d8f-4623-cdd8-08d7f24eb994',
                                vin: 'AEGCC11B2LP000805',
                                country: null,
                                engineCode: 'SQRE4G15BAAKL00205',
                                transmissionSn: 'QR525MHJLAKL07535'
                            },
                            {
                                id: '00df3676-5b5d-49ac-b9c3-08d7f24eb9a9',
                                technologyActivityId: '4bef9c59-4d8f-4623-cdd8-08d7f24eb994',
                                vin: 'AEGCC11B2LP000806',
                                country: null,
                                engineCode: 'SQRE4G15BAAKL00185',
                                transmissionSn: 'QR525MHJLAKL07516'
                            },
                            {
                                id: '2eda03f1-ab93-4a0f-b9c4-08d7f24eb9a9',
                                technologyActivityId: '4bef9c59-4d8f-4623-cdd8-08d7f24eb994',
                                vin: 'AEGCC11B2LP000807',
                                country: null,
                                engineCode: 'SQRE4G15BAAKL00146',
                                transmissionSn: 'QR525MHJLAKL07531'
                            },
                            {
                                id: 'e41ea6de-04db-4093-b9c5-08d7f24eb9a9',
                                technologyActivityId: '4bef9c59-4d8f-4623-cdd8-08d7f24eb994',
                                vin: 'AEGCC11B2LP000808',
                                country: null,
                                engineCode: 'SQRE4G15BAAKL00067',
                                transmissionSn: 'QR525MHJLAKL07480'
                            },
                            {
                                id: 'f8e20757-b6d6-46dc-b9c6-08d7f24eb9a9',
                                technologyActivityId: '4bef9c59-4d8f-4623-cdd8-08d7f24eb994',
                                vin: 'AEGCC11B2LP000809',
                                country: null,
                                engineCode: 'SQRE4G15BAAKL00167',
                                transmissionSn: 'QR525MHJLAKL07549'
                            }
                        ],
                        pageSize: 20,
                        pageIndex: 0,
                        totalPages: 2,
                        totalElements: 21
                    },
                    technologyActivityResultList: [
                        {
                            id: 'string',
                            approverName: 'approverName',
                            approveTime: '2020-04-29T07:19:06.584Z',
                            result: 0,
                            approveComment: 'approveComment'
                        }
                    ]
                }
            }
        }
    );
});
router.put('/:id', (req, res) => {
    res.json({
        message: '编辑成功'
    });
});
router.post('/', (req, res) => {
    res.json({
        message: '新增成功'
    });
});
router.post('/vinImport', (req, res) => {
    //发运单导入
    res.json({
        message: '导入成功'
    });
});
router.put('/:id/submit', (req, res) => {
    res.json({
        message: '提交成功'
    });
});
router.put('/:id/abandon', (req, res) => {
    res.json({
        message: '作废成功'
    });
});
router.put('/:id/publish', (req, res) => {
    res.json({
        message: '发布成功'
    });
});
router.put('/:id/close', (req, res) => {
    res.json({
        message: '关闭成功'
    });
});
router.put('/:id/pass', (req, res) => {
    res.json({
        message: '审核通过成功'
    });
});
router.put('/:id/reject', (req, res) => {
    res.json({
        message: '审核不通过成功'
    });
});
router.put('/:id/rejectToPrev', (req, res) => {
    res.json({
        message: '驳回成功'
    });
});
router.get('/:id/export', (req, res) => {
    res.json({
        message: '导出成功'
    });
});
router.get('/vinImportTemp', (req, res) => {
    res.json({
        message: '导入模版'
    });
});
module.exports = router;
